import 'package:dio/dio.dart';


class HttpRequest {
  final Dio dio = Dio();

  HttpRequest(){
    dio.options.baseUrl = "https://www.soscoon.com/";
    dio.options.receiveTimeout = 15000;
    dio.interceptors
      ..add(InterceptorsWrapper(
        onRequest: (RequestOptions options,RequestInterceptorHandler handler) {
          options.headers["csrfToken"] = "csrfToken";
          print('加入token>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>');
        },
        onResponse: (Response response,ResponseInterceptorHandler handler) {
          print('onResponse------------------');
        },
        onError: (DioError error,ErrorInterceptorHandler handler) {
          print('---------------->>>>>>>>>>>>>>>>>>error');
          print(error);
        }
      ))
    ..add(LogInterceptor());
  }
}